import {
	Tools,
	Modal,
} from 'weaver-mobile';
import React, {
	Component
} from 'react';
const getLabel = Tools.getLabel;

export default class DeleteConfirm extends Component{
	constructor(props){
		super(props);

		this.state = {
			visible:false
		}
	}

	componentDidMount() {
		this.setState({visible:true});
	}

	handleCancel = () => {
		this.setState({visible:false});
	}


	render() {
		const {
			visible
		} = this.state, {
			handleOk,
			handleCancel,
			msg
		} = this.props;

		if (!visible) {
			return null;
		}

		const btns = [{
			text: getLabel(32694, '取消'),
			onPress:this.handleCancel
		},{
			text: getLabel(33703, '确定'),
			onPress:() => {
				handleOk();
				this.handleCancel();
			} ,
		}];

		return (
			<Modal 
				transparent
				visible={visible}
				onClose={this.handleCancel}
				title={""}
				footer={btns}
			>
              <p>
                 {msg}
              </p>
			</Modal>
		);
	}
}